﻿#ifndef CLOUDMODELS_H
#define CLOUDMODELS_H

#include <QString>
#include <QMetaType>

/// @brief 对象基础结构(基类)
///
struct BaseObject
{
    QString name;

    bool isValid() const
    {
        return !isInvalid();
    }
    bool isInvalid() const
    {
        return name.isNull() || name.isEmpty();
    }
};
Q_DECLARE_METATYPE(BaseObject);

/// @brief 桶结构
///
struct MyBucket: public BaseObject
{
    QString location;
    QString createDate;
};
Q_DECLARE_METATYPE(MyBucket);

/// @brief 对象结构
struct MyObject: public BaseObject
{
    QString lastmodified;
    qulonglong size = 0;
    QString dir;
    QString key;

    bool isDir() const
    {
        return isValid() && name.endsWith("/");
    }
    bool isFile() const
    {
        return isValid() && !name.endsWith("/");
    }
};
Q_DECLARE_METATYPE(MyObject);

#endif // CLOUDMODELS_H
